<template>
  <el-dialog title="数据配置" :visible.sync="visible" fullscreen center>
    <el-button class="miui-dialog-close-btn" @click="visible = false">关闭页面</el-button>
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="320px">
      <div class="config-common">
        <h3 class="module-title">默认图片配置</h3>
        <div class="module-content">
          <div class="module-picture">
            <div class="picture-header">
              <div class="picture-button">
                <el-upload
                  class="upload-demo"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  multiple
                  :limit="3">
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </div>
              <div class="picture-remarks">此项目用于设定门店列表图文中的第一张默认大图，建议尺寸（640*320）</div>
            </div>
            <div class="picture-content">
              <div class="picture-button">预览</div>
              <div class="picture-remarks"></div>
            </div>
          </div>

          <div class="module-picture">
            <div class="picture-header">
              <div class="picture-button">
                <el-upload
                  class="upload-demo"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  multiple
                  :limit="3">
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </div>
              <div class="picture-remarks">此项目用于设定文章列表图文中的第一张默认大图，建议尺寸（640*320）</div>
            </div>
            <div class="picture-content">
              <div class="picture-button">预览</div>
              <div class="picture-remarks"></div>
            </div>
          </div>

          <div class="module-picture">
            <div class="picture-header">
              <div class="picture-button">
                <el-upload
                  class="upload-demo"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  multiple
                  :limit="3">
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </div>
              <div class="picture-remarks">此项目用于设定文章列表图文中的非一张默认小图，建议尺寸（80*80）</div>
            </div>
            <div class="picture-content">
              <div class="picture-button">预览</div>
              <div class="picture-remarks"></div>
            </div>
          </div>

          <div class="module-picture">
            <div class="picture-header">
              <div class="picture-button">
                <el-upload
                  class="upload-demo"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  multiple
                  :limit="3">
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </div>
              <div class="picture-remarks">此项目用于设定个人中心中的企业Logo，建议尺寸（640*320）</div>
            </div>
            <div class="picture-content">
              <div class="picture-button">预览</div>
              <div class="picture-remarks"></div>
            </div>
          </div>

          <div class="module-picture">
            <div class="picture-header">
              <div class="picture-button">
                <el-upload
                  class="upload-demo"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  multiple
                  :limit="3">
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </div>
              <div class="picture-remarks">此项目用于设定会员资料中的默认图，建议尺寸（640*320）</div>
            </div>
            <div class="picture-content">
              <div class="picture-button">预览</div>
              <div class="picture-remarks"></div>
            </div>
          </div>

        </div>
      </div>


      <div class="config-common">
        <h3 class="module-title">其他配置信息</h3>
        <div class="module-content">
          <el-form-item label="注册协议对应文章内容" prop="registerAgreement">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.registerAgreement" placeholder="注册协议对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="积分兑换协议对应文章内容" prop="integralChange">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.integralChange" placeholder="积分兑换协议对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="预约说明对应对应文章内容" prop="appointmentDescription">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.appointmentDescription" placeholder="预约说明对应对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="最新技术分享" prop="latestTechnologySharing">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.latestTechnologySharing" placeholder="最新技术分享"></el-input> -->
          </el-form-item>
          <el-form-item label="联系我们中的联系方式对应文章内容" prop="contactWay">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.contactWay" placeholder="联系我们中的联系方式对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="联系我们中的来店路线对应文章内容" prop="storeRoute">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.storeRoute" placeholder="联系我们中的来店路线对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="最新活动" prop="latestActivity">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.latestActivity" placeholder="最新活动"></el-input> -->
          </el-form-item>
          <el-form-item label="邀请好友中的说明对应文章内容" prop="inviteFriend">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.inviteFriend" placeholder="邀请好友中的说明对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="邀请好友成功分享页面中的说明对应文章内容" prop="inviteFriendShare">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.inviteFriendShare" placeholder="邀请好友成功分享页面中的说明对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="蓝星、红星会员区别说明对应文章内容" prop="memberDifferent">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.memberDifferent" placeholder="蓝星、红星会员区别说明对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="微信预约说明对应文章内容" prop="wxAppointmentDescription">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.wxAppointmentDescription" placeholder="微信预约说明对应文章内容"></el-input> -->
          </el-form-item>
          <el-form-item label="邀请好友隐私权政策说明对应文章内容" prop="inviteFriendPrivacy">
            <el-button type="primary" icon="el-icon-check">选择</el-button>
            <!-- <el-input v-model="dataForm.inviteFriendPrivacy" placeholder="邀请好友隐私权政策说明对应文章内容"></el-input> -->
          </el-form-item>
        </div>
      </div>

      <div class="config-common">
        <h3 class="module-title">提示语配置</h3>
        <div class="module-content">
          <el-form-item label="会员注册成功页面弹出信息" prop="registerSuccessInfo">
            <el-input v-model="dataForm.registerSuccessInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="邀请好友成功页面弹出信息" prop="inviteFriendSuccessInfo">
            <el-input v-model="dataForm.inviteFriendSuccessInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="邀请好友失败页面弹出信息" prop="inviteFriendFailInfo">
            <el-input v-model="dataForm.inviteFriendFailInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="积分商城兑换成功弹出信息" prop="integralChangeSuccessInfo">
            <el-input v-model="dataForm.integralChangeSuccessInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="积分商城兑换确认弹出信息" prop="integralChangeAffirmInfo">
            <el-input v-model="dataForm.integralChangeAffirmInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="微信预约成功页面弹出信息" prop="wxAppointmentSuccessInfo">
            <el-input v-model="dataForm.wxAppointmentSuccessInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="微信预约失败页面弹出信息" prop="wxAppointmentFailInfo">
            <el-input v-model="dataForm.wxAppointmentFailInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="微信绑定填写详细信息时备注内容" prop="wechatBindingInfo">
            <el-input v-model="dataForm.wechatBindingInfo" style="width: 480px;"></el-input>
          </el-form-item>
          <el-form-item label="微信未绑定时点击菜单弹出内容" prop="wechatUnbound">
            <el-input v-model="dataForm.wechatUnbound" style="width: 480px;"></el-input>
          </el-form-item>
        </div>
      </div>

      <div class="config-common">
        <h3 class="module-title">名词配置</h3>
        <div class="module-content">
          <el-form-item label="【积分】在系统中显示为" prop="integralShow">
            <el-input v-model="dataForm.integralShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="【储值卡】在系统中显示为" prop="saveMoneyCardShow">
            <el-input v-model="dataForm.saveMoneyCardShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="【消息中心】的最新医嘱在系统中显示为" prop="doctorAdviceShow">
            <el-input v-model="dataForm.doctorAdviceShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="【消息中心】的最新诊疗信息在系统中显示为	" prop="diagnosisInfoShow">
            <el-input v-model="dataForm.diagnosisInfoShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心主页面【我的病例】在系统中显示为" prop="myCaseShow">
            <el-input v-model="dataForm.myCaseShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【挂号支付】功能的显示名称" prop="registerPayShow">
            <el-input v-model="dataForm.registerPayShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【我的资料】功能的显示名称" prop="myDataShow">
            <el-input v-model="dataForm.myDataShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【消息中心】功能的显示名称	" prop="messageCenterShow">
            <el-input v-model="dataForm.messageCenterShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【配镜支付】功能的显示名称" prop="prescribeSpectaclesPayShow">
            <el-input v-model="dataForm.prescribeSpectaclesPayShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【我的代金券】功能的显示名称" prop="myVoucherShow">
            <el-input v-model="dataForm.myVoucherShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【邀请好友】功能的显示名称" prop="inviteFriendShow">
            <el-input v-model="dataForm.inviteFriendShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【预约挂号】功能的显示名称" prop="appointmentRegisterShow">
            <el-input v-model="dataForm.appointmentRegisterShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【我的积分】功能的显示名称" prop="myIntegralShow">
            <el-input v-model="dataForm.myIntegralShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【客户服务】功能的显示名称" prop="customerServiceShow">
            <el-input v-model="dataForm.customerServiceShow" style="width: 120px;"></el-input>
          </el-form-item>
          <el-form-item label="个人中心中的【专属客服】功能的显示名称" prop="dedicatedCustomerServiceShow">
            <el-input v-model="dataForm.dedicatedCustomerServiceShow" style="width: 120px;"></el-input>
          </el-form-item>
        </div>
      </div>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
    data() {
      return {
        visible: false,
        dataForm: {
          id: 0,
          storeList: '',
          articleList: '',
          articleListTwo: '',
          enterpriseLogo: '',
          customerData: '',
          registerAgreement: '',
          integralChange: '',
          appointmentDescription: '',
          latestTechnologySharing: '',
          contactWay: '',
          storeRoute: '',
          latestActivity: '',
          inviteFriend: '',
          inviteFriendShare: '',
          memberDifferent: '',
          wxAppointmentDescription: '',
          inviteFriendPrivacy: '',
          registerSuccessInfo: '',
          inviteFriendSuccessInfo: '',
          inviteFriendFailInfo: '',
          integralChangeSuccessInfo: '',
          integralChangeAffirmInfo: '',
          wxAppointmentSuccessInfo: '',
          wxAppointmentFailInfo: '',
          wechatBindingInfo: '',
          wechatUnbound: '',
          integralShow: '',
          saveMoneyCardShow: '',
          doctorAdviceShow: '',
          diagnosisInfoShow: '',
          myCaseShow: '',
          registerPayShow: '',
          myDataShow: '',
          messageCenterShow: '',
          prescribeSpectaclesPayShow: '',
          myVoucherShow: '',
          inviteFriendShow: '',
          appointmentRegisterShow: '',
          myIntegralShow: '',
          customerServiceShow: '',
          dedicatedCustomerServiceShow: '',
          createTime: '',
          createUser: '',
          updateTime: '',
          updateUser: '',
          delFlag: '',
          tenantId: ''
        },
        dataRule: {

        }
      }
    },
    methods: {
      init(id) {
        this.dataForm.id = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.id) {
            getWxConfigurationObj(this.dataForm.id).then(response => {
              this.dataForm = response.data.data
            })
          }
        })
      },
      // 表单提交
      dataFormSubmit() {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            if (this.dataForm.id) {
              putWxConfigurationObj(this.dataForm).then(data => {
                this.$message.success('修改成功')
                this.visible = false
                this.$emit('refreshDataList')
              });
            } else {
              addWxConfigurationObj(this.dataForm).then(data => {
                this.$message.success('添加成功')
                this.visible = false
                this.$emit('refreshDataList')
              })
            }
          }
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .config-common {
    background-color: #d8e6db;
    // background-color: #fff;
    margin-bottom: 10px;
    .module-title {
      font-size: 16px;
      font-weight: 700;
      color: #999;
      border-bottom: 1px solid #f2f2f2;
      height: 40px;
      line-height: 40px;
      padding-left: 20px;
    }
    .module-content {
      padding: 20px;
      // border: solid 1px #f2f2f2;
      .module-picture {
        border: solid 1px #f2f2f2;
        .picture-header {
          display: flex;
          justify-content: flex-start;
          border-bottom: solid 1px #f2f2f2;
          padding: 10px;
          box-sizing: border-box;

          .picture-button {
            width: 200px;
            text-align: center;
          }
        }
        .picture-content {
          display: flex;
          justify-content: flex-start;
          height: 120px;
          line-height: 120px;
          .picture-button {
            width: 200px;
            text-align: center;
          }
        }

      }
    }
  }
</style>
